package independence.hibernate;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.orm.hibernate3.HibernateTemplate;

/**
 * The <code>IndyDAO</code> interface defines methods for getting and setting a DAO's
 * <code>HibernateTemplate</code> and <code>SessionFactory</code> as well as retrieving
 * new <code>Session</code> objects to operate upon.
 * 
 * @author TK, TK Assembled for Independence Honor.
 */
public interface IndyDAO {
	/**
	 * Sets this <code>IndyDAO</code> instance's <code>SessionFactory</code> instance.
	 * @param	value	The <code>SessionFactory</code> which this DAO should operate upon.
	 */
	public void setSessionFactory(SessionFactory value);
	/**
	 * Returns this DAO's Hibernate <code>SessionFactory</code> instance.
	 * @return	This instance's <code>SessionFactory</code> object.
	 */
	public SessionFactory getSessionFactory();
	/**
	 * Sets this <code>IndyDAO</code> instance's <code>HibernateTemplate</code> object.
	 * @param value	The <code>HibernateTemplate</code> which this DAO should operate upon.
	 */
	public void setHibernateTemplate(HibernateTemplate value);
	/**
	 * Returns the <code>HibernateTemplate</code> of this data access object. The <code>HibernateTemplate</code>
	 * provides access to simple CRUD methods for creating, reading, updating, and deleting objects. 
	 * @return	This DAO's <code>HibernateTemplate</code> instance.
	 */
	public HibernateTemplate getHibernateTemplate();
	/**
	 * Opens and returns a new Session object for performing persistence operations on and through. 
	 * @return	Returns the newly opened Session implementation.
	 */
	public Session getSession();
	/**
	 * Releases a session from memory, enabling it to be recycled and reused by other connections.
	 * @param	value	The <code>Session</code> to release and close.
	 */
	public void releaseSession(Session value);
}
